package router

import (
	"github.com/gin-gonic/gin"
	"goods_bff/api/goods"
	"goods_bff/middlerware"
)

func InitGoodsRouter(router *gin.Engine) {
	GoodsRouter := router.Group("g/v1/goods").Use(middlerware.QPS())
	{
		GoodsRouter.GET("", goods.List)              //商品列表
		GoodsRouter.POST("", goods.New)              //改接口需要管理员权限
		GoodsRouter.GET("/:id", goods.Detail)        //获取商品的详情
		GoodsRouter.GET("/:id/stocks", goods.Stocks) //获取商品的库存

		GoodsRouter.PUT("/:id", goods.Update)
		GoodsRouter.PATCH("/:id", goods.UpdateStatus)
	}
}
